<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="box">
      <div class="box1">111</div>
    </div>
    <script>
      var boxEle = document.querySelector(".box");
      var p = document.createElement("p");
      var box1 = document.querySelector(".box1");
      p.innerHTML = "222";

      //   document.onclick = function () {
      //     boxEle.replaceChild(p, box1);
      //   };
      //   document.onclick = function () {
      //     boxEle.insertBefore(p, box1);
      //   };
      var res = boxEle.cloneNode();
      console.log(res);
    </script>
  </body>
</html>
